<!DOCTYPE html>
<html lang="en">
<include file="Public/header" title="消息修改" keywords="社团管理系统，常州大学，课程设计" />

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div method="get" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">消息标题</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" value="{$res['messagetitle']}" id="messagetitle">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">消息内容</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" value="{$res['messagecontent']}" id="messagecontent">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <button id="subbtn" class="btn btn-w-m btn-info" type="button" data-id="{$res['messageid']}">确认提交</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<include file="Public/footer"/>
<script>
    $('#subbtn').on('click',function () {
        var btn = $(this);
        var messageid = btn.data('id');
        var messagetitle = $('#messagetitle').val();
        var messagecontent = $('#messagecontent').val();
        var param = {
            messageid: messageid,
            messagetitle:messagetitle,
            messagecontent:messagecontent,
        };
        console.log(param);
        var url = "{:U('Message/messagemodify')}";
        $.ajax({
            url: url,
            data: param,
            dataType: 'json',
            type: 'post',
            success: function (data) {
                alert(data.info);
                if (data.status == 1) {
                    window.location.href= "{:U('Message/departmessage')}"
                }
            },
            error: function () {
                alert('操作失败');
            }
        })
    })
</script>
</html>